﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace CoolChat
{
    public class MsgReturn
    {
        public MsgReturn()
        {
            ChatUser u = Tools.getCurUser();
            if (u != null)
            {
                this.silence = u.SilenceExpires > DateTime.Now;
            }
        }

        private KeyValuePair<ClientAct,string>[] act;

        /// <summary>
        /// 设置Act的值时,只会将值追加到数据当中,这是为了实现客户端响应多操作.
        /// 如果需要一个全新的Act值,请将值设为null
        /// </summary>
        public KeyValuePair<ClientAct, string>[] Act
        {
            get { return act; }
            set 
            {
                if (value == null || act == null)
                {
                    act = value;
                }
                else
                {
                    KeyValuePair<ClientAct, string>[] tmp = new KeyValuePair<ClientAct, string>[value.Length + act.Length];
                    for (int i = 0; i < act.Length; ++i)
                    {
                        tmp[i] = act[i];
                    }
                    for (int i = 0; i < value.Length; ++i)
                    {
                        tmp[act.Length + i] = value[i];
                    }
                    act = tmp;
                }
            }
        }
        private Alert.Alert alert;

        public Alert.Alert Alert
        {
            get { return alert; }
            set { alert = value; }
        }
        private bool silence = false;

        public bool Silence
        {
            get { return silence; }
            set { silence = value; }
        }
    }
}